package com.ssy.lingxi.product.handler.exception;

import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

/**
 * 上传文件超限制异常
 * @author jw.chen
 * @version 2.0.0
 * @date 2022/4/8
 */
@RestControllerAdvice
@Order(5)
public class FileUploadExceptionHandler {
    @ExceptionHandler(MaxUploadSizeExceededException.class)
    public Wrapper<?> handlerMaxUploadFile(MaxUploadSizeExceededException ex) {
        return Wrapper.fail(ResponseCode.UPLOADED_FILE_SIZE_EXCEPTION);
    }
}
